-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AccountModule: Bypass connection hooks on local / unknown networks #1474
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few notes for clarification:
} | ||
|
||
if ( | ||
clientListening && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to check the native client connection; if not we could have a false positive when the client websockets suddenly close.
const isWalletAndClientSynced = | ||
Math.abs(walletSyncDelay - clientSyncDelay) <= OK_PROVIDER_SYNC_DELAY | ||
const networkSlowdown = | ||
walletSyncDelay >= MILD_PROVIDER_SYNC_DELAY && | ||
clientSyncDelay >= MILD_PROVIDER_SYNC_DELAY && | ||
isWalletAndClientSynced | ||
const networkName = network.shortName.toLowerCase() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using network.shortName
instead of network.type
due to this issue. The reason I'm not using chainId
is because this is only for local / unknown chains where we don't know its behavior, and the chainId
can be changed with an environment variable for local networks. Might add a comment for clearing this up!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, ❤️ how simple this was!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌 LGTM!
On local networks that are not simulating block mining, the Account Module eventually will show there may be sync issues / no connection due to it not detecting any activity on-chain. This is desired behavior, but we need to avoid it on local chains.